<!-- 头部 -->
<link rel="stylesheet" href="css/ali/font_508931_vxc9n1ii82n019k9.css" />
<link rel="stylesheet" href="css/head_top_footer.css" />
<script src="js/jquery.min.js"></script>
<script src="js/hk库.js"></script>
<script src="js/head.js"></script>
<script>
	$server = 'http://localhost:8080/';
	$(function(){
		// 登录
		$.ajax({
			type: "POST",
			url: $server+'user/get_user_info.do',
			crossDomain:true, //设置跨域为true
			xhrFields:{
				withCredentials: true // 携带跨域cookie
			},
			success: function(result){
				console.log(result);
				if (result.code == 200){
					$("#user_name")[0].innerHTML = result.data.username;
				}else{
					window.location.href = 'login.html';
					//alert(result.msg);
				}
			}
		});
		
		// 获取分类菜单
		$.ajax({
			type: 'POST',
			url: $server+'category/list.do',
			crossDomain: true,
			xhrFields:{
				withCredentials: true
			},
			success: function(result){
				console.log(result);
				if (result.code == 200){
					// 填充数据
					$htmlstr = '';
					$.each(result.data, function(index, value){
						$htmlstr += '<div class="mbdd_ification">' +
							'<div>' +
								'<a href=commodityList.html?categoryId='+value.id+'><span>'+value.name+'</span></a>' +
								'<span class="mbdd_ification111">></span>' +
							'</div>' +
							'<ul>';
						$tmp = '';
						$.each(value.categoryChildVoList, function(cIndex, cValue){
							$tmp += '<li><a href=commodityList.html?categoryId='+cValue.id+'>'+cValue.name+'</a></li>';
						});
						$htmlstr += $tmp +		
							'</ul>' +
						'</div>';
					});
					$('#my_menu').html($htmlstr);
				}else{
					alert(result.msg);
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){
				alert(textStatus);
			}
		});
		
		// 购物车商品种类
		$.ajax(
		{
			url: $server+'cart/list.do',
			type: "POST",
			datatype: 'json',		
			crossDomain:true, //设置跨域为true
			xhrFields:{
				withCredentials: true // 携带跨域cookie
			},
			success: function(result){
				if (result.code == 200 && result.data != undefined && result.data.cartCommodityVoList != null){
					$('.buyCar_news')[0].innerHTML = result.data.cartCommodityVoList.length;
				}else{
					$('.buyCar_news')[0].innerHTML = 0;
				}				
			},
		});
	});
</script>
<div id="head_top">
	<!--顶部黑条-->
	<div id="home_top">
		<div class="home_top">
			<div class="hello"><span>您好，欢迎来到龙仕达</span></div>
			<div class="home_sign">
				<!--第二个a是红色-->
				<!--<a href="dengluye.html">登录</a>-->
				<!--<a href="zhuce.html">注册</a>-->
				<a href="#"></a>
				<a href="user.html" id="user_name"></a>
				<a href="memberCenter.html">会员中心</a>
				<a href="order.html">我的订单</a>
				<a href="#">帮助反馈</a>
			</div>
		</div>
	</div>

	<!--logo 搜索框-->
	<div id="home_search">
		<div class="logo">
			<a href="index.html"><span class="logo-span"></span></a>
		</div>
		<div class="home_search">
			<div class="home_TopSearch">
				<input id="search_str" type="text" placeholder="   搜索产品" />
				<div></div>
				<a href="javascript:void(0);" onclick="searchc()"><span></span></a>
			</div>
			<div class="home_TopSearch_bo">
				<a href="commodityList.html?keyword=篮球"><span>篮球</span></a>
				<a href="commodityList.html?keyword=足球"><span>足球</span></a>
				<a href="commodityList.html?keyword=羽毛球"><span>羽毛球</span></a>
				<a href="commodityList.html?keyword=运动服"><span>运动服</span></a>
			</div>
		</div>
		<a href="cart.html">
			<div class="Shopping_Cart">
				<div><img src="img/home-page/buyCar.png" alt=""></div>
				<span>我的购物车</span>
				<div class="buyCar_news">
					0
				</div>
			</div>
		</a>
	</div>

	<!--菜单栏-->
	<div id="menu_bar">
		<div id="menu_bar_drop_down">
			<span class="menu_bar_bar-1">全部商品分类 <i class="iconfont icon-xiala "></i></span>
		</div>
		<!--首页-特惠-->
		<div id="menu_bar_bar">
			<ul id="mb_bar">
				<li>
					<a href="index.html">
						<span class="mb_bar_li_a_nth-child1">首页</span>
					</a>
				</li>
				<li>
					<a href="#">球类</a>
				</li>
				<li>
					<a href="#">运动鞋</a>
				</li>
				<li>
					<a href="#">健身器材</a>
				</li>
				<li>
					<a href="#">体育器材</a>
				</li>
				<li>
					<a href="#">运动休闲设备</a>
				</li>
				<li>
					<a href="#">团购</a>
				</li>
				<li>
					<a href="#">特惠</a>
				</li>
			</ul>
		</div>
		
		<!--商品分类 隐藏-->
		<div id="mb_drop_down_bar">
			<div class="classification">
				<a>
					<div id="my_menu">
						
					</div>
					<!-- <div class="mbdd_ification">
						<div>
							<span>球类</span>
							<span class="mbdd_ification111">></span>
						</div>
						<ul>
							<li>篮球</li>
							<li>羽毛球</li>
							<li>排球</li>
							<li>网球</li>
							<li>足球</li>
						</ul>
					</div> -->
				<!-- 	<div class="mbdd_ification">
						<div>
							<span>运动鞋</span>
							<span class="mbdd_ification111">></span>
						</div>
						<ul>
							<li>篮球鞋</li>
							<li>羽毛球鞋</li>
							<li>排球鞋</li>
							<li>网球鞋</li>
							<li>足球鞋</li>
						</ul>
					</div>
					<div class="mbdd_ification">
						<div>
							<span>健身器材</span>
							<span class="mbdd_ification111">></span>
						</div>
						<ul>
							<li>跑步机</li>
							<li>健身车</li>
							<li>划船器</li>
							<li>杠铃哑铃设备</li>
						</ul>
					</div>
					<div class="mbdd_ification">
						<div>
							<span>体育器材</span>
							<span class="mbdd_ification111">></span>
						</div>
						<ul>
							<li>乒乓球桌</li>
							<li>台球桌</li>
							<li>地板</li>
							<li>场地设施</li>
							<li>拳击设备</li>
						</ul>
					</div>
					<div class="mbdd_ification">
						<div>
							<span>运动休闲设备</span>
							<span class="mbdd_ification111">></span>
						</div>
						<ul>
							<li>按摩椅</li>
							<li>律动仪</li>
							<li>律动沙发</li>
							<li>律动床</li>
						</ul>
					</div> -->
				</a>
			</div>
		</div>
		
	</div>
</div>
